﻿using System;
using System.Text;
using System.Data;
using System.Data.OleDb;
using System.Collections.Generic;
using System.Reflection;

namespace BLL
{
 
    public static class Documentary
    {
        private static Data.Documentary Data_Newscont = new Data.Documentary();

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static long Add(Model.Documentary model)
        {
            return Data_Newscont.Add(model);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static int Update(Model.Documentary model)
        {
            return Data_Newscont.Update(model);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public static bool Delete(long Id)
        {
            return Data_Newscont.Delete(Id);
        }
        /// <summary>
        /// 单条
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public static Model.Documentary GetModel(long Id)
        {
            return Data_Newscont.GetModel(Id);
        }
        /// <summary>
        /// 上一篇
        /// </summary>
        /// <param name="IndexID"></param>
        /// <param name="tName"></param>
        /// <param name="condition"></param>
        /// <returns></returns>
        public static Model.Documentary Prv(long IndexID, string condition)
        {
            string sql = "";
            if (condition == "")
            {

                sql = "SELECT top 1  * FROM Documentary WHERE Id <" + IndexID + " ORDER BY Id DESC";
            }
            else
            {
                sql = "select top 1 * from Documentary where Id<" + IndexID + " and " + condition + " order by Id desc";
            }

            return Data_Newscont.GetModelBysql(sql);

        }
        public static Model.Documentary NewsTopOne(string sql)
        {
            return Data_Newscont.GetModelBysql(sql);

        }
        /// <summary>
        /// 下一篇
        /// </summary>
        /// <param name="IndexID"></param>
        /// <param name="tName"></param>
        /// <param name="condition"></param>
        /// <returns></returns>
        public static Model.Documentary Next(long IndexID, string condition)
        {
            string sql = "";
            if (condition == "")
            {
                sql = "SELECT top 1 * FROM Documentary WHERE Id >" + IndexID + " ORDER BY Id asc";
            }
            else
            {
                sql = "select top 1 * from Documentary where Id>" + IndexID + " and " + condition + " order by Id desc";
            }
            return Data_Newscont.GetModelBysql(sql);

        }
        /// <summary>
        /// 总数据数
        /// </summary>
        /// <returns></returns>
        public static int GetAll_Count()
        {
            return Data_Newscont.GetAll_Count();
        }
        /// <summary>
        /// 抽取分页数据
        /// </summary>

        public static DataTable GetPageListBysql(string sql)
        {
            return Data_Newscont.GetPageListBysql(sql);
        }

        public static List<Model.Documentary> GetPageListBysql(int pageIndex, int pageSize, long newsclassid, out int totalCount)
        {
            return Data_Newscont.GetPageList_Where(pageIndex, pageSize, newsclassid, out totalCount);
        }


     
        public static List<Model.Documentary> GetPageListBysql(int pageIndex, int pageSize, string sql, out int totalCount)
        {
            return Data_Newscont.GetPageListWhere(pageIndex, pageSize, sql, out totalCount);
        }
        public static List<Model.Documentary> GetPageList_Where(int pageIndex, int pageSize, long newsclassid, out int totalCount)
        {
            return Data_Newscont.GetPageList_Where(pageIndex, pageSize, newsclassid, out totalCount);
        }
        public static List<Model.Documentary> GetPageListWhere(int pageIndex, int pageSize,  int LotteryChippedid, out int totalCount)
        {
            return Data_Newscont.GetPageListWhere(pageIndex, pageSize, LotteryChippedid, out totalCount);
        }
        public static DataTable GetPageDT_Where(int PageIndex, int PageSize, long newsclassid, out int totalCount)
        {
            return Data_Newscont.GetPageDT_Where(PageIndex, PageSize, newsclassid, out totalCount);
        }
        public static DataTable GetPageDTWhere(int PageIndex, int PageSize, int LotteryChippedid, out int totalCount)
        {
            return Data_Newscont.GetPageDTWhere(PageIndex, PageSize, LotteryChippedid, out totalCount);
        }
        /// <summary>
        /// <summary>
        /// 批删
        /// </summary>
        /// <param name="Ids"></param>
        /// <returns></returns>
        public static int Drop(string Ids)
        {
            return Data_Newscont.Drop(Ids);
        }

        public static int GetAll_Count(int LotteryChippedid)
        {
            return Data_Newscont.GetAll_Count(LotteryChippedid);
        }
    }

}
